package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.system.mapper.ClassManageMapper;
import com.ruoyi.system.pojo.domain.ClassManage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.RepeatMapper;
import com.ruoyi.system.pojo.domain.Repeat;
import com.ruoyi.system.service.IRepeatService;

/**
 * 留级管理Service业务层处理
 * 
 * @author sxb
 * @date 2024-01-22
 */
@Service
public class RepeatServiceImpl implements IRepeatService 
{
    @Autowired
    private RepeatMapper repeatMapper;
    @Autowired
    private ClassManageMapper classManageMapper;

    /**
     * 查询留级管理
     * 
     * @param id 留级管理主键
     * @return 留级管理
     */
    @Override
    public Repeat selectRepeatById(Long id)
    {
        return repeatMapper.selectRepeatById(id);
    }

    /**
     * 查询留级管理列表
     * 
     * @param repeat 留级管理
     * @return 留级管理
     */
    @Override
    public List<Repeat> selectRepeatList(Repeat repeat)
    {
        return repeatMapper.selectRepeatList(repeat);
    }

    /**
     * 新增留级管理
     * 
     * @param repeat 留级管理
     * @return 结果
     */
    @Override
    public int insertRepeat(Repeat repeat)
    {
        ClassManage classManage = classManageMapper.selectClassManageByClassName(repeat.getClassName());
        repeat.setClassId(classManage.getId());
        return repeatMapper.insertRepeat(repeat);
    }

    /**
     * 修改留级管理
     * 
     * @param repeat 留级管理
     * @return 结果
     */
    @Override
    public int updateRepeat(Repeat repeat)
    {
        return repeatMapper.updateRepeat(repeat);
    }

    /**
     * 批量删除留级管理
     * 
     * @param ids 需要删除的留级管理主键
     * @return 结果
     */
    @Override
    public int deleteRepeatByIds(Long[] ids)
    {
        return repeatMapper.deleteRepeatByIds(ids);
    }

    /**
     * 删除留级管理信息
     * 
     * @param id 留级管理主键
     * @return 结果
     */
    @Override
    public int deleteRepeatById(Long id)
    {
        return repeatMapper.deleteRepeatById(id);
    }
}
